data_column Derived Type

type, public :: data_column

Defines a column of data within a data_table object.


Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: m_name

A header, or column name.


Type-Bound Procedures

procedure(data_column_append), public, deferred, pass :: append

Appends one value, initializing an unallocated column if needed. Discard existing views before this operation.

  • subroutine data_column_append(this, x) Prototype

    Appends a scalar of the column's type; strings also accept character.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout) :: this
    class(*), intent(in) :: x

procedure(data_column_array_copy), public, deferred, pass :: copy

Copies the contents of the column to an array.

  • pure subroutine data_column_array_copy(this, dest) Prototype

    Defines a mechanism to retrieve a copy of an array. The destination must match the column's type and count. An unallocated column is treated as empty.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(in) :: this

    The data_column object.

    class(*), intent(inout), dimension(:) :: dest

    The destination array, overwritten in full on success.

procedure(data_column_integer_query), public, deferred, pass :: count

Gets the number of items stored in the column.

  • pure function data_column_integer_query(this) result(rst) Prototype

    Defines an integer property query on a data_column object.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(in) :: this

    The data_column object.

    Return Value integer(kind=int32)

    The property value.

procedure(data_column_integer_query), public, deferred, pass :: get_data_type

Gets the data type stored by the column:

  • FS_COLUMN_INTEGER

  • FS_COLUMN_REAL

  • FS_COLUMN_LOGICAL

  • FS_COLUMN_STRING

  • pure function data_column_integer_query(this) result(rst) Prototype

    Defines an integer property query on a data_column object.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(in) :: this

    The data_column object.

    Return Value integer(kind=int32)

    The property value.

procedure, public :: get_name => dc_get_name

  • private pure function dc_get_name(this) result(rst)

    Gets the name associated with the column.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(in) :: this

    The data_column object.

    Return Value character(len=:), allocatable

    The name.

procedure(data_column_insert), public, deferred, pass :: insert

Inserts one value before row, in the range 1 through count() + 1. Discard existing views before this operation.

  • subroutine data_column_insert(this, row, x) Prototype

    Inserts a scalar of the column's type; strings also accept character.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout) :: this
    integer(kind=int32), intent(in) :: row
    class(*), intent(in) :: x

procedure(data_column_remove), public, deferred, pass :: remove

Removes one row, in the range 1 through count(). Discard existing views before this operation.

  • subroutine data_column_remove(this, row) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout) :: this
    integer(kind=int32), intent(in) :: row

procedure, public :: set_name => dc_set_name

  • private subroutine dc_set_name(this, x)

    Sets the name associated with the column.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout) :: this

    The data_column object.

    character(len=*), intent(in) :: x

    The name.

procedure(data_column_slice), public, deferred, pass :: slice

Borrows a mutable array pointer to a slice of the column without copying the column. The actual column must have TARGET or be an associated pointer. The caller must not deallocate the returned pointer. Reallocation of the array or destruction of the column invalidates the view; discard it before either operation and reacquire afterward.

  • function data_column_slice(this, first, last) result(rst) Prototype

    Returns a borrowed, mutable slice of this column's array.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout), target :: this

    The data_column object.

    integer(kind=int32), intent(in) :: first

    The one-based starting index of the slice.

    integer(kind=int32), intent(in) :: last

    The one-based ending index of the slice.

    Return Value class(*), pointer, dimension(:)

    The array pointer, or null if unallocated.

procedure(data_column_to_string), public, deferred, pass :: to_string

Converts the requested value to a string.

  • function data_column_to_string(this, row, fmt) result(rst) Prototype

    Returns the value in the requested row as a string.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(in) :: this

    The data_column object.

    integer(kind=int32), intent(in) :: row

    The row index.

    character(len=*), intent(in), optional :: fmt

    The formatting string.

    Return Value character(len=:), allocatable

    The resulting string.

procedure(data_column_array_view), public, deferred, pass :: view

Borrows a mutable array pointer without copying the column. The actual column must have TARGET or be an associated pointer. The caller must not deallocate the returned pointer. Reallocation of the array or destruction of the column invalidates the view; discard it before either operation and reacquire afterward.

  • function data_column_array_view(this) result(rst) Prototype

    Returns a borrowed pointer to the column's array.

    Arguments

    Type IntentOptional Attributes Name
    class(data_column), intent(inout), target :: this

    The data_column object that owns the array.

    Return Value class(*), pointer, dimension(:)

    The mutable view, or null if the array is unallocated.